
#include<algorithm>
#include<cstring>
using namespace std;
const int MAXINT=2100000000;
struct In
{
	int x,y,no;
}a[501];
bool cmp(In a,In b)
{
	return a.y<b.y;
}
bool inside(int i,int j)
{
	bool ans=false;
	if(a[i].x>a[j].x&&a[i].y<a[j].y)ans=true;
//	if(a[i].x==a[j].x&&a[i].y==a[j].y)ans=false;
	return ans;
}
int n,f[501],p[501],ansp[501];
int main()
{
	freopen("test.in","r",stdin);
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d",&a[i].x,&a[i].y);
		a[i].no=i;
	}
	sort(a+1,a+n+1,cmp);
	f[1]=1;
	memset(p,0,sizeof(p));
	for(int i=2;i<=n;i++)
	{
		f[i]=1;
		for(int j=i-1;j>=1;j--)
		if(inside(j,i)&&f[i]<f[j]+1)
		{
			f[i]=f[j]+1;
			p[i]=j;
		}
	}
	int ans=-1*MAXINT,t,count=0;
	for(int i=1;i<=n;i++)
		if(ans<f[i]){ans=f[i];t=i;}
	while(t!=0)
	{
		count++;
		ansp[count]=a[t].no;
		t=p[t];
	}
	printf("%d\n",ans);
	for(int i=count;i>=1;i--)
		printf("%d\n",ansp[i]);
	return 0;
}

